package com.channel.config.thread;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 线程池配置类
 */
@Component
public class AsyncTaskProperties {

    public static int corePoolSize;
    public static int maxPoolSize;
    public static int keepAliveSeconds;
    public static int queueCapacity;

    public static int getCorePoolSize() {
        return corePoolSize;
    }
    @Value("${task.pool.core-pool-size}")
    public static void setCorePoolSize(int corePoolSize) {
        AsyncTaskProperties.corePoolSize = corePoolSize;
    }

    public static int getMaxPoolSize() {
        return maxPoolSize;
    }

    @Value("${task.pool.max-pool-size}")
    public static void setMaxPoolSize(int maxPoolSize) {
        AsyncTaskProperties.maxPoolSize = maxPoolSize;
    }

    public static int getKeepAliveSeconds() {
        return keepAliveSeconds;
    }
    @Value("${task.pool.keep-alive-seconds}")
    public static void setKeepAliveSeconds(int keepAliveSeconds) {
        AsyncTaskProperties.keepAliveSeconds = keepAliveSeconds;
    }

    public static int getQueueCapacity() {
        return queueCapacity;
    }
    @Value("${task.pool.queue-capacity}")
    public static void setQueueCapacity(int queueCapacity) {
        AsyncTaskProperties.queueCapacity = queueCapacity;
    }
}
